<template>
  <el-card>
    <el-table :data="resourceList" style="width: 100%;">
      <el-table-column prop="resource_id" label="资源ID" width="80" />
      <el-table-column prop="resource_name" label="资源名称" />
      <el-table-column prop="phone_number" label="联系电话" />
      <el-table-column prop="location" label="地址" />
      <el-table-column prop="open_hours" label="开放时间" />
    </el-table>
  </el-card>
</template>

<script setup>
import { ref, onMounted } from 'vue';
import { getAllCampusResources } from '@/api/resource';

const resourceList = ref([]);

const loadResources = async () => {
  resourceList.value = await getAllCampusResources();
};

onMounted(() => {
  loadResources();
});
</script>
